/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package com.lifesting.wfs.Runtime.impl;

import com.lifesting.wfs.Runtime.*;

import com.lifesting.wfs.Runtime.addon.WorkflowException;
import java.util.HashMap;
import java.util.Stack;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class RuntimeFactoryImpl extends EFactoryImpl implements RuntimeFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static RuntimeFactory init() {
		try {
			RuntimeFactory theRuntimeFactory = (RuntimeFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.lifesting.com/workflow/runtime/1.0"); 
			if (theRuntimeFactory != null) {
				return theRuntimeFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new RuntimeFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RuntimeFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case RuntimePackage.PROCESS_INSTANCE: return createProcessInstance();
			case RuntimePackage.TOKEN: return createToken();
			case RuntimePackage.CONTEXT: return createContext();
			case RuntimePackage.ROUTER: return createRouter();
			case RuntimePackage.NODE_EXECUTOR: return createNodeExecutor();
			case RuntimePackage.START_EXECUTOR: return createStartExecutor();
			case RuntimePackage.END_EXECUTOR: return createEndExecutor();
			case RuntimePackage.FORK_EXECUTOR: return createForkExecutor();
			case RuntimePackage.JOIN_EXECUTOR: return createJoinExecutor();
			case RuntimePackage.TASK_RUNNER_EXECUTOR: return createTaskRunnerExecutor();
			case RuntimePackage.AUTO_RUN_EXECUTOR: return createAutoRunExecutor();
			case RuntimePackage.VARIABLE_FRAME: return createVariableFrame();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case RuntimePackage.WORKFLOW_EXCEPTION:
				return createWorkflowExceptionFromString(eDataType, initialValue);
			case RuntimePackage.JAVA_STACK:
				return createJavaStackFromString(eDataType, initialValue);
			case RuntimePackage.JAVA_HASH_MAP:
				return createJavaHashMapFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case RuntimePackage.WORKFLOW_EXCEPTION:
				return convertWorkflowExceptionToString(eDataType, instanceValue);
			case RuntimePackage.JAVA_STACK:
				return convertJavaStackToString(eDataType, instanceValue);
			case RuntimePackage.JAVA_HASH_MAP:
				return convertJavaHashMapToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProcessInstance createProcessInstance() {
		ProcessInstanceImpl processInstance = new ProcessInstanceImpl();
		return processInstance;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Token createToken() {
		TokenImpl token = new TokenImpl();
		return token;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Context createContext() {
		ContextImpl context = new ContextImpl();
		return context;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Router createRouter() {
		RouterImpl router = new RouterImpl();
		return router;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NodeExecutor createNodeExecutor() {
		NodeExecutorImpl nodeExecutor = new NodeExecutorImpl();
		return nodeExecutor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public StartExecutor createStartExecutor() {
		StartExecutorImpl startExecutor = new StartExecutorImpl();
		return startExecutor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EndExecutor createEndExecutor() {
		EndExecutorImpl endExecutor = new EndExecutorImpl();
		return endExecutor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ForkExecutor createForkExecutor() {
		ForkExecutorImpl forkExecutor = new ForkExecutorImpl();
		return forkExecutor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public JoinExecutor createJoinExecutor() {
		JoinExecutorImpl joinExecutor = new JoinExecutorImpl();
		return joinExecutor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TaskRunnerExecutor createTaskRunnerExecutor() {
		TaskRunnerExecutorImpl taskRunnerExecutor = new TaskRunnerExecutorImpl();
		return taskRunnerExecutor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AutoRunExecutor createAutoRunExecutor() {
		AutoRunExecutorImpl autoRunExecutor = new AutoRunExecutorImpl();
		return autoRunExecutor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VariableFrame createVariableFrame() {
		VariableFrameImpl variableFrame = new VariableFrameImpl();
		return variableFrame;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WorkflowException createWorkflowExceptionFromString(EDataType eDataType, String initialValue) {
		return (WorkflowException)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertWorkflowExceptionToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Stack<?> createJavaStackFromString(EDataType eDataType, String initialValue) {
		return (Stack<?>)super.createFromString(initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertJavaStackToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public HashMap<?, ?> createJavaHashMapFromString(EDataType eDataType, String initialValue) {
		return (HashMap<?, ?>)super.createFromString(initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertJavaHashMapToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RuntimePackage getRuntimePackage() {
		return (RuntimePackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static RuntimePackage getPackage() {
		return RuntimePackage.eINSTANCE;
	}

} //RuntimeFactoryImpl
